import 'package:flutter/material.dart';

class SampleSliverAppbar extends StatelessWidget {
  const SampleSliverAppbar({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return CustomScrollView(
      slivers: [
        SliverAppBar(
          floating: true,
          snap: true,
          pinned: true,
          expandedHeight: 250,
          flexibleSpace: FlexibleSpaceBar(
            title: Text(
              "SampleSliverAppbar",
              textAlign: TextAlign.center,
            ),
            background: Image.network(
              'https://img2.baidu.com/it/u=2184053653,3921542411&fm=26&fmt=auto',
              fit: BoxFit.cover,
            ),
          ),
        ),
        SliverFixedExtentList(
          delegate: SliverChildBuilderDelegate((context, index) {
            return Container(
              color: Colors.primaries[index],
            );
          }, childCount: Colors.primaries.length),
          itemExtent: 100,
        )
      ],
    );
  }
}
